﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HyEduOnline.Entities;
using HyEduOnline.Server.Admin;
using HyEduOnline.Services;
using HyEduOnline.Models;

namespace HyEduOnline.Controllers
{
    [UserAuthorizeSys]
    public class SysMangerController : Controller
    {
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Home()
        {
            return View();
        }


        /// <summary>
        /// 管理员导航
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 左侧菜单栏
        /// </summary>
        /// <returns></returns>
        public ActionResult Menu()
        {
            ViewBag.MenuTree = Session["SysMenus"];
            return View();
        }


        /// <summary>
        /// 通用数据导入
        /// </summary>
        /// <returns></returns>
        public ActionResult CommonDataImport()
        {

            return View();
        }


        /// <summary>
        /// 通用SQL语句管理
        /// </summary>
        /// <returns></returns>
        public ActionResult CommonSQLMangement()
        {
            ViewBag.UserID = FrontUserInfo.GetUserID();  //add by yzp
            return View();
        }

        /// <summary>
        /// 数据导出
        /// </summary>
        /// <returns></returns>
        public ActionResult CommonDataExport()
        {
            return View();
        }

        /// <summary>
        /// 部门管理视图
        /// </summary>
        /// <returns></returns>

        public ActionResult Part()
        {
            return View();
        }

        /// <summary>
        /// 页面管理
        /// </summary>
        /// <returns></returns>
        public ActionResult Power()
        {
            return View();
        }

        //教学大纲编辑页面
        public ActionResult TeachingOutline(int id)
        {
            //课程Id
            ViewBag.Id = id;
            return View();
        }
        
        /// <summary>
        /// 角色管理
        /// </summary>
        /// <returns></returns>
        public ActionResult Role()
        {
            return View();
        }



        /// <summary>
        /// 用户管理视图
        /// </summary>
        /// <returns></returns>

        public ActionResult Users()
        {
            List<TbSysPart> PartList = new SyspartDAO().GetByPage("I_ParentId=" + 0, 0, int.MaxValue).ToList();
            IList<TbSysRole> list = new SysRoleBaseDAO().GetAll();
            ViewBag.roleList = list;
            ViewBag.partList = PartList;
            return View();
        }



        /// <summary>
        /// 教师信息管理
        /// </summary>
        /// <returns></returns>
        public ActionResult Teacher()
        {
            List<TbDeanCollege> PartList = new DeanCollegeDAO().GetByPage("I_ParentId=" + 0, 0, int.MaxValue).ToList();

            //拼接学院代码和学院名称，使其同时在下拉列表中显示
            for (int i = 0; i < PartList.Count; i++)
            {
                string CodeAndName = PartList[i].SCollegeCode +"_"+ PartList[i].SCollegeName;
                PartList[i].SCollegeName = CodeAndName;
            }

            ViewBag.partList = PartList;
            return View();
        }

        /// <summary>
        /// 学生信息管理
        /// </summary>
        /// <returns></returns>
        public ActionResult Student()
        {
            List<TbDeanCollege> List = new DeanCollegeDAO().GetByPage("I_ParentId=" + 0, 0, int.MaxValue).ToList();//取学院及专业
            

            //拼接学院代码和学院名称，使其同时在下拉列表中显示
            for (int i = 0; i < List.Count; i++)
            {
                string CodeAndName = List[i].SCollegeCode + "_" + List[i].SCollegeName;
                List[i].SCollegeName = CodeAndName;                
            }

            ViewBag.partList = List;
            return View();
        }


        /// <summary>
        /// 课程管理
        /// </summary>
        /// <returns></returns>
        public ActionResult DeanCourse()
        {
            List<TbDeanCollege> CollegeList = new DeanCollegeDAO().GetByPage("I_ParentId=" + 0, 0, int.MaxValue).ToList();//取学院及专业
            ViewBag.collegeList = CollegeList;
            return View();
        }

        /// <summary>
        /// 班级管理
        /// </summary>
        /// <returns></returns>
        public ActionResult DeanClass()
        {           
            List<TbDeanCollege> CollegeList = new DeanCollegeDAO().GetByPage("I_ParentId=" + 0, 0, int.MaxValue).ToList();//取学院及专业

            ViewBag.collegeList = CollegeList;
            return View();
        }

        /// <summary>
        /// 学年学期管理
        /// </summary>
        /// <returns></returns>
        public ActionResult DeanTerm()
        {
            return View();
        }
        
        /// <summary>
        /// 开课管理
        /// </summary>
        /// <returns></returns>
        public ActionResult DeanOpenCourse()
        {
            return View();
        }

        /// <summary>
        /// 学生选课管理
        /// </summary>
        /// <returns></returns>
        public ActionResult DeanStuSelCourse()
        {
            ViewBag.termList = new DeanTermDAO().GetAll();
            return View();
        }
        
        /// <summary>
        /// 学院、专业管理
        /// </summary>
        /// <returns></returns>
        public ActionResult DeanCollege()
        {
            return View();
        }


        /// <summary>
        /// 系统公告
        /// </summary>
        /// <returns></returns>
        public ActionResult Notices()
        {
            return View();
        }

        /// <summary>
        /// 公告用户，主要指学生和教师
        /// </summary>
        /// <returns></returns>
        public ActionResult NoticeUser()
        {

            return View();
        }

        /// <summary>
        /// 考试安排
        /// </summary>
        /// <returns></returns>
        public ActionResult TestArrange()
        {
            return View();
        }


    }
}
